package com.ljx.itbbs.server.user.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ljx.itbbs.server.user.domain.entity.RoleMenuRelationEntity;
import com.ljx.itbbs.server.user.domain.vo.resp.MenuResp;
import com.ljx.itbbs.server.user.mapper.RoleMenuRelationMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 角色菜单关联表 服务实现类
 * </p>
 *
 * @author LiJunXi
 * @since 2024-03-02
 */
@Service
public class RoleMenuRelationDao extends ServiceImpl<RoleMenuRelationMapper, RoleMenuRelationEntity> {

    public List<MenuResp> getRoleMenuList(Long roleId) {
        return this.baseMapper.getRoleMenuList(roleId);
    }

    public void deleteByRoleId(Long roleId) {
        this.baseMapper.delete(new LambdaQueryWrapper<RoleMenuRelationEntity>()
                .eq(RoleMenuRelationEntity::getRoleId, roleId));
    }
}
